/**
 * 
 */
package pt.inescid.components.console.commands;

import pt.inescid.components.console.Console;

/**
 * @author Sergio Esteves (sesteves at gsd.inesc-id.pt)
 *
 */
public class SetWorkTimeCommand extends Command {

	public static final String CMD_NAME = "set_work_time";
	
	public SetWorkTimeCommand(Console console) {
		super(console);
	}
		
	@Override
	public void execute(String[] args) throws CommandException {
		validateArgs(args, 2, 3);			
		int lboundHour = Integer.parseInt(args[1]);	
		gridP2P.setLboundHour(lboundHour);
		if(lboundHour >= 0) {
			int uboundHour = Integer.parseInt(args[2]);
			gridP2P.setUboundHour(uboundHour);
		}
	}

	@Override
	public String getCmdName() {
		return CMD_NAME;
	}

	@Override
	public String synopsis() {
		return CMD_NAME + " lboundHour uboundHour" + SYNTAX_SEPARATOR +
			"sets the time interval. lboundHour and uboundHour are the lower " + 
			"and upper interval references. -1 for Anytime" ;
	}

}
